package com.example.demo.controller;


import com.example.demo.service.PhotoService;
import com.example.demo.common.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;


/**
 * @author T480
 */
@Controller
@RequestMapping(value = "test",method = RequestMethod.POST)
public class TestController {

    @Autowired
    private PhotoService photoService;
    @RequestMapping(value = "photo",method = RequestMethod.POST)
    public Response photo(@RequestParam("file")MultipartFile file) throws IOException {
        Response response = new Response();
        Boolean aBoolean = photoService.add(file);

        String fileName = file.getOriginalFilename();

        return response;
    }

}
